package com.kly.sc.api.application.enums;

import com.kly.sc.api.infras.enums.RestCodeEnum;
import com.kly.sc.api.infras.exception.ApplicationException;

public enum UserBehavior {
    BROWSE(1,"browse", "浏览用户数"),

    LIKES(1,"likes", "喜欢用户数"),

    CONVERSATIONS(1,"conversations","会话"),

    FIRST_CONVERSATION(5,"firstSession", "破冰会话数"),

    EFFECTIVE_CONVERSATIONS(3,"validSession", "有效会话数"),

    DEEP_CONVERSATIONS(1,"deepSession", "深度会话数"),

    SESSION_MESSAGE_LIMIT(100,"sessionLimit", "会话消息上限"),

    ;
    private int limit;

    private String code;
    private String description;

    public static UserBehavior fromType(String value) {
        for (UserBehavior userStatus : values()) {
            if (userStatus.getCode().equals(value)) {
                return userStatus;
            }
        }
        throw new ApplicationException(ApiResultStatus.INCORRECT_VERIFICATION_LABEL);
    }

    UserBehavior(int limit, String code, String description) {
        this.limit = limit;
        this.code = code;
        this.description = description;
    }

    UserBehavior(String description) {
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public int getLimit() {
        return limit;
    }

    public void setLimit(int limit) {
        this.limit = limit;
    }
}
